<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/common/includes.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>zzzzzz - Settings</title>
<%@ include file="/WEB-INF/common/meta.jsp"%>
<%@ include file="/WEB-INF/common/global_res.jsp"%>
<script type="text/javascript" src="${ctx}/res/jquery/validate/jquery.validate.min.js"></script>
<script type="text/javascript" src="${ctx}/res/jquery/validate/messages_zh_CN.js"></script>
<script type="text/javascript">
	
</script>
</head>
<body>

	<%@ include file="/WEB-INF/common/header.jsp"%>

	<div class="container">
		<div id="settings" class="row">
			<div class="span1">&nbsp;</div>
			<div class="span10">
				<div class="tabbable tabs-left">
					<%@ include file="menu.jsp"%>
					<div class="tab-content">
						<div class="row-fluid">
							<div class="span8">
								<c:if test="${not empty message}">
									<div class="${message.type.cssClass}">${message.text}</div>
								</c:if>
								<form:form id="editPortraitForm" modelAttribute="editPortraitForm" action="${ctx}/account/settings/portrait" method="post" enctype="multipart/form-data" class="form-horizontal">
									<form:errors path="*" element="div" cssClass="msg-error" />
									<legend>
										<small>修改头像</small>
									</legend>
									<fieldset>
										<div class="control-group">
											<label for="thumbnail" class="control-label">头像</label>
											<div class="controls">
												<c:choose>
													<c:when test="${editPortraitForm.portraitId == null || empty editPortraitForm.portraitId}">
														<img src="${ctx}/res/images/default_portrait.png" class="thumb thumb_128" />
													</c:when>
													<c:otherwise>
														<img src="${ctx}/image/${editPortraitForm.portraitId}" class="thumb thumb_128" />
													</c:otherwise>
												</c:choose>
											</div>
										</div>
										<div class="control-group">
											<label for="files" class="control-label">选择文件</label>
											<div class="controls">
												<form:input path="files" type="file" style="width:308px;" />
												<form:errors path="files" />
											</div>
										</div>
										<div class="control-group">
											<div class="controls">
												<input class="btn" type="submit" name="submit" value="上传" />
											</div>
										</div>

									</fieldset>
								</form:form>
							</div>
							<div class="span4 well" style="margin-top: 20px;">
								<h3>修改头像</h3>
								<p>在这里您可以上传头像，图片大小不能大于200K。</p>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="span1">&nbsp;</div>
		</div>
	</div>

	<script type="text/javascript">
		
	</script>

	<%@ include file="/WEB-INF/common/footer.jsp"%>

</body>
<script type="text/javascript">
	$(function() {
		var isValueChanged = false;

		$('input[type=file]').change(function(e) {
			isValueChanged = true;
		});

		$("#editPortraitForm").submit(function(e) {
			if (!isValueChanged) {
				alert("请选择一张图像并上传");
				return false;
			}
		});

	});
</script>
</html>
